//
//  HCContentButton.m
//  HappyChildren
//
//  Created by WillyZhao on 2017/1/16.
//  Copyright © 2017年 WillyZhao. All rights reserved.
//

#import "HCContentButton.h"

@interface HCContentButton ()

@end

@implementation HCContentButton

-(instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        [self initializeSubViews:frame];
    }
    return self;
}

-(void)initializeSubViews:(CGRect)frame {
    //左边按钮
    UIButton *btna = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, frame.size.width/2.0-20, frame.size.height-20)];
    [btna setBackgroundImage:[UIImage imageNamed:@"happy_home_contenta"] forState:UIControlStateNormal];
    [self addSubview:btna];
    
    //添加分割线
    UIView *view_a = [[UIView alloc] initWithFrame:CGRectMake((frame.size.width-1)/2.0, 0, 1, frame.size.height)];
    view_a.backgroundColor = YBKRGBCOLOR(242, 242, 242, 1);
    [self addSubview:view_a];
    
    UIView *view_b = [[UIView alloc] initWithFrame:CGRectMake(view_a.frame.origin.x+0.5, (frame.size.height - 1)/2.0, frame.size.width - view_a.frame.origin.x-view_a.frame.size.width, 1)];
    view_b.backgroundColor = YBKRGBCOLOR(242, 242, 242, 1);
    [self addSubview:view_b];
    
    
    UIButton *btnc = [[UIButton alloc] initWithFrame:CGRectMake(view_a.frame.origin.x+view_a.frame.size.width+10, view_b.frame.origin.y+view_b.frame.size.height+10, btna.frame.size.width, frame.size.height/2.0-20)];
    [btnc setBackgroundImage:[UIImage imageNamed:@"happy_home_contentc"] forState:UIControlStateNormal];
    [self addSubview:btnc];
    
    UIButton *btnb = [[UIButton alloc] initWithFrame:CGRectMake(btnc.frame.origin.x, 10, btnc.frame.size.width, btnc.frame.size.height)];
    [btnb setBackgroundImage:[UIImage imageNamed:@"happy_home_contentb"] forState:UIControlStateNormal];
    [self addSubview:btnb];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
